﻿FlyTalk.views.SearchView = Ext.extend(Ext.TabPanel, {
	scroll: false,
    indicator: true,
    fullscreen: true,
    layout: 'card', 	

	tabBar:{
        dock: 'bottom', // will put the menu on the bottom of the screen
		layout:{
			type: 'hbox',
			pack: 'center' // this will center the menu
        },		
    },


    initComponent: function () {
    	Ext.apply(FlyTalk.views, {
    		SearchPostView: new FlyTalk.views.SearchPostView(),
    		SearchMapTab: new FlyTalk.views.SearchMapTab(),
			OfficialView: new FlyTalk.views.OfficialView(),
        });

		this.backButton = new Ext.Button({
			text: 'Back',
			ui: 'back',
			handler: this.backButtonTap,
			scope: this
		});
		
		this.toolbar = new Ext.Toolbar({
			title: 'Results',
			doc: 'top',
			layout: 'hbox',
			items: [
			    this.backButton,
				{xtype: 'spacer'},
				//this.composeButton,
			]
		});
		
		this.dockedItems = [this.toolbar];

		this.items = [
		    FlyTalk.views.OfficialView, 
			FlyTalk.views.SearchPostView, 
			FlyTalk.views.SearchMapTab, 
		];
		FlyTalk.views.SearchMapTab.doComponentLayout();
		FlyTalk.views.SearchView.superclass.initComponent.call(this);
        
    },
    
	//home button
    backButtonTap: function () {
    	FlyTalk.views.mainView.setActiveItem(FlyTalk.views.SearchSearchView, {type: 'slide', direction: 'right'});
    },

});